


#ifndef PF_LEADER_H
#define PF_LEADER_H

#include "pf_entity.h"
#include "pf_entitycontainer.h"
#include "lx_Export.h"


/**
 * Holds the data that defines a leader.
 */
class LX_EXPORT PF_LeaderAttribute {
public:
    PF_LeaderAttribute() {}
    PF_LeaderAttribute(bool arrowHeadFlag) {
        arrowHead = arrowHeadFlag;
    }

    friend std::ostream& operator << (std::ostream& os,
                                      const PF_LeaderAttribute& /*ld*/) {
        os << "(Leader)";
        return os;
    }

	/** true: leader has an arrow head. false: no arrow. */
	bool arrowHead;
};



/**
 * Class for a leader entity (kind of a polyline arrow).
 *

 */
class LX_EXPORT PF_Leader : public PF_Container {
public:
    PF_Leader(PF_Container* parent=NULL);
    PF_Leader(PF_Container* parent,
                const PF_LeaderAttribute& d);
    virtual ~PF_Leader();

    virtual PF_Entity* clone() {
        PF_Leader* p = new PF_Leader(*this);
        p->setOwner(isOwner());
        p->initId();
        p->detach();
        return p;
    }

    /**	@return LX_Define::EntityDimLeader */
    virtual LX_Define::EntityType rtti() const {
        return LX_Define::EntityDimLeader;
    }

	virtual void update();

    /** @return Copy of data that defines the leader. */
    PF_LeaderAttribute getData() const {
        return data;
    }

	/** @return true: if this leader has an arrow at the beginning. */
	bool hasArrowHead() {
		return data.arrowHead;
	}

    virtual PF_Entity* addVertex(const PF_Vector& v);
    virtual void addEntity(PF_Entity* entity);

	virtual double getLength() {
		return -1.0;
	}
	
    virtual void move(PF_Vector offset);
    virtual void rotate(PF_Vector center, double angle);
    virtual void scale(PF_Vector center, PF_Vector factor);
    virtual void mirror(PF_Vector axisPoint1, PF_Vector axisPoint2);
    virtual void stretch(PF_Vector firstCorner,
                         PF_Vector secondCorner,
                         PF_Vector offset);

    friend std::ostream& operator << (std::ostream& os, const PF_Leader& l);

protected:
    PF_LeaderAttribute data;
	bool empty;
};

#endif
